package com.ruoyi.swimming.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.swimming.domian.Customer;
import com.ruoyi.swimming.domian.MallCategory;
import com.ruoyi.swimming.mapper.CustomerMapper;
import com.ruoyi.swimming.mapper.MallCategoryMapper;
import com.ruoyi.swimming.service.IMallCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 商城类目Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-17
 */
@Service
public class MallCategoryServiceImpl extends ServiceImpl<MallCategoryMapper, MallCategory> implements IMallCategoryService
{
    @Autowired
    private MallCategoryMapper mallCategoryMapper;

    /**
     * 查询商城类目
     * 
     * @param id 商城类目ID
     * @return 商城类目
     */
    @Override
    public MallCategory selectMallCategoryById(Long id)
    {
        return mallCategoryMapper.selectMallCategoryById(id);
    }

    /**
     * 查询商城类目列表
     * 
     * @param mallCategory 商城类目
     * @return 商城类目
     */
    @Override
    public List<MallCategory> selectMallCategoryList(MallCategory mallCategory)
    {
        return mallCategoryMapper.selectMallCategoryList(mallCategory);
    }

    /**
     * 新增商城类目
     * 
     * @param mallCategory 商城类目
     * @return 结果
     */
    @Override
    public int insertMallCategory(MallCategory mallCategory)
    {
        mallCategory.setCreateTime(DateUtils.getNowDate());
        return mallCategoryMapper.insert(mallCategory);
    }

    /**
     * 修改商城类目
     * 
     * @param mallCategory 商城类目
     * @return 结果
     */
    @Override
    public int updateMallCategory(MallCategory mallCategory)
    {
        mallCategory.setUpdateTime(DateUtils.getNowDate());
        return mallCategoryMapper.updateById(mallCategory);
    }

    /**
     * 批量删除商城类目
     * 
     * @param ids 需要删除的商城类目ID
     * @return 结果
     */
    @Override
    public int deleteMallCategoryByIds(Long[] ids)
    {
        return mallCategoryMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除商城类目信息
     * 
     * @param id 商城类目ID
     * @return 结果
     */
    @Override
    public int deleteMallCategoryById(Long id)
    {
        return mallCategoryMapper.deleteById(id);
    }
}
